<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>21_js根据用输入显示季度业绩柱状图</title>
  <style>
     .box{
            display: flex;
            justify-content: space-around;
            align-items: flex-end;
            margin:100px auto;
            width: 400px;
            height: 300px;
            border-left:  1px solid pink;
            border-bottom: 1px solid pink;
        }
        .box>div{
            position: relative;
            width: 50px;
            height: 100px;
            background-color: pink;
        }
         .box>div>span{
            position: absolute;
            width: 50px;
            top:-25px;
            text-align: center;
         }
        .box>div>p{
            position: absolute;
            width: 80px;
            bottom: -35px;
            left:-15px;
          text-align: center;
      
        }
  </style>
</head>
<body>


  <script>
    let arr=[];
        for(let i=0;i<4;i++){
            let num=+prompt(`请输入第${i+1}季度`)
            arr.push(num);
        }
        console.log(arr)

        let str='<div class="box">';
            for(let j=0;j<4;j++){
            str+=`
               <div style='height:${arr[j]}px'>
           <span>${arr[j]}</span>
             <p>第${j+1}季度</p>
              </div>
           `;
    }
              str+='</div>';
             
           
                        document.write(str);
                        console.log(str)






  </script>
</body>
</html>